package com.fashion.utils;

import org.springframework.stereotype.Service;

import java.util.Comparator;

/**
 * User: Administrator
 * Date: 11-11-3
 * Time: 下午2:15
 */
@Service("newsTemplateSorter")
public class NewsTemplateSorter  implements Comparator {
    @Override
    public int compare(Object o1, Object o2) {
        int level1 = ((NewsTemplate) o1).getLevel();
        int level2 = ((NewsTemplate) o2).getLevel();

        if(level1 == level2){
            return 0;
        }

        return (level2 - level1);
    }
}
